<?php
/*********************/
/*                   */
/*  Version : 5.1.0  */
/*  Author  : RM     */
/*  Comment : 071223 */
/*                   */
/*********************/

define( "JIEQI_MODULE_NAME", "system" );
define( "JIEQI_ADMIN_LOGIN", 1 );
require_once( "../global.php" );
include_once( JIEQI_ROOT_PATH."/class/power.php" );
$power_handler =& jieqipowerhandler::getinstance( "JieqiPowerHandler" );
$power_handler->getsavedvars( "system" );
jieqi_checkpower( $jieqiPower['system']['adminpanel'], $jieqiUsersStatus, $jieqiUsersGroup, false, true );
include_once( JIEQI_ROOT_PATH."/admin/header.php" );
$jieqiTpl->assign( "jieqi_adminleft", JIEQI_URL."/admin/left.php" );
if ( isset( $_SESSION['adminurl'], $_SESSION['adminurl'] ) )
{
		$jieqiTpl->assign( "jieqi_adminmain", $_SESSION['adminurl'] );
}
else
{
		$jieqiTpl->assign( "jieqi_adminmain", JIEQI_URL."/admin/main.php" );
}
if ( !empty( $_SESSION['jieqiUserId'] ) )
{
		$jieqiTpl->assign( "username", jieqi_htmlstr( $_SESSION['jieqiUserName'] ) );
		$jieqiTpl->assign( "usergroup", $jieqiGroups[$_SESSION['jieqiUserGroup']] );
}
include_once( JIEQI_ROOT_PATH."/class/modules.php" );
$modules_handler =& jieqimoduleshandler::getinstance( "JieqiModulesHandler" );
$criteria = new criteriacompo( new criteria( "publish", 1, "=" ) );
$criteria->setsort( "weight" );
$criteria->setorder( "ASC" );
$modules_handler->queryobjects( $criteria );
unset( $criteria );
$jieqiModary = array( );
while ( $v = $modules_handler->getobject( ) )
{
		$jieqiModary[$v->getvar( "name", "n" )] = array(
				"name" => $v->getvar( "name", "n" ),
				"caption" => $v->getvar( "caption", "n" ),
				"description" => $v->getvar( "description", "n" ),
				"version" => sprintf( "%0.2f", intval( $v->getvar( "version", "n" ) ) / 100 ),
				"vtype" => $v->getvar( "vtype", "n" ),
				"publish" => $v->getvar( "publish", "n" )
		);
}
$jieqiTpl->assign_by_ref( "jieqimodules", $jieqiModary );
if ( defined( "JIEQI_VERSION_TYPE" ) && defined( "LANG_VERSION_".strtoupper( JIEQI_VERSION_TYPE ) ) )
{
		$jieqiTpl->assign( "jieqi_vtype", constant( "LANG_VERSION_".strtoupper( JIEQI_VERSION_TYPE ) ) );
}
else
{
		$jieqiTpl->assign( "jieqi_vtype", "" );
}
$jieqiTpl->display( JIEQI_ROOT_PATH."/templates/admin/index.html" );
?>
